<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
<title>订单明细</title>
<%@ include file="/pages/wx/baseHead.jsp"%>
<style type="text/css">
.btn-my { background: #cb60b3; /* Old browsers */ 
background: -moz-linear-gradient(top, #cb60b3 0%, #ad1283 50%, #de47ac 100%);/* FF3.6+ */ 
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #cb60b3),color-stop(50%, #ad1283), color-stop(100%, #de47ac) ); /* Chrome,Safari4+ */ 
background : -webkit-linear-gradient( top, #cb60b3 0%,#ad1283 50%, #de47ac 100%); /* Chrome10+,Safari5.1+ */ 
background: -o-linear-gradient(top, #cb60b3 0%, #ad1283 50%, #de47ac 100%);/* Opera 11.10+ */ 
background: -ms-linear-gradient(top, #cb60b3 0%, #ad1283 50%, #de47ac 100%);/* IE10+ */ 
background: linear-gradient(to bottom, #cb60b3 0%, #ad1283 50%, #de47ac 100%);/* W3C */ 
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#cb60b3',endColorstr='#de47ac', GradientType=0 ); /* IE6-9 */ }
.btn-my{ width: 100px; height: 100px; -moz-border-radius: 50%; -webkit-border-radius: 50%; border-radius: 50%; }
.btn-my { background: gray; color:#ffffff; }
</style>
<script type="text/javascript">
	
	
var timeOutEvent=0;
	$(function(){
		//confirm('标题','内容',function(){alert(1);});
		//openToast('我操');
		//openDia('标题','信息');
		//loading('sss');
		//setTimeout("unLoading();",2000);
		initWxSdk();
	});
	
	
	
	function initWxSdkOk()
	{
		$("#touchArea")[0].style.background = '#04BE02';
		$("#msg").html('点击扫描条形码/二维码');
	}
	
	function scan()
	{
		wx.scanQRCode({
		    needResult: 1, // 默认为0，扫描结果由微信处理，1则直接返回扫描结果，
		    scanType: ["qrCode","barCode"], // 可以指定扫二维码还是一维码，默认二者都有
		    success: function (res) {
		    	var result = res.resultStr; // 当needResult 为 1 时，扫码返回的结果
		    	var ret = result.split(',');
		    	if(ret.length<2)
		    	{
		    		openDia('提示',"请扫描正确的条码");
		    		return;
		    	}
		    	bindBarCode(ret[1]);
			}
		});
	}
	
	function bindBarCode(barcode)
	{
		var sn = $("#sn").val();
		if(isNull(barcode)) return;
		var regs = /^[A-Za-z0-9]+$/;
		if(!regs.test(barcode))
		{
			openDia('提示','请输入正确的条码');
			return;
		}
		confirm('提示','扫码成功,条码为：<font color="red">'+barcode+'</font>，是否绑定到该订单？',function(){
			var url = '${urlBasePath}weixin/user/bindBarCode.do';
			$.ajax({
				url:url,
				async:true,
				data:{
					sn:sn,
					barcode:barcode
				},
				success:function(ret){
					if(ret.code == '0')
					{
						$("#barcodeFont").html(barcode);
						//openToast('绑定成功');
						confirm('提示','绑定成功!',function(){
							to('expressMySend.do');
						});
					}else
					{
						openDia('提示',ret.msg);
					}
				},
				error:function(){
					
				}
			});
			
		});
	}
	
</script>

</head>
<body>
<input type="hidden" id="sn" value="${obj.sn }">

<c:if test="${obj.state == '01'}">
		<div align="center" style="color: red;padding-bottom: 10px;padding-top: 15px;">该订单处于"待扫码寄件"状态，请尽快绑定条形码</div>
</c:if>
<c:if test="${obj.state == '02'}">
		<div align="center" style="color: red;padding-bottom: 10px;padding-top: 15px;">该订单处于"待揽收"状态，您可以重新绑定条形码</div>
</c:if>

<div class="bd" id="orderInfo" style="margin-top: 0px;">
    <div class="weui_panel weui_panel_access">
	
	    <div style="position: absolute;right: 10px;top: 100px;z-index: 10;">
	    	<c:forEach var="state" items="${states }">
	          	<c:if test="${state.value == obj.state }">
		                		${state.text }
	            </c:if>
			 </c:forEach>
	         <c:if test="${obj.payState == '00' }"><div style="color: #04BE02;">已支付</div></c:if>
			 <div style="display: block;padding-top: 6px;"></div>
			 <c:if test="${obj.amount > 0 && obj.payState != '00' && obj.forPublic == '02' && user.id == obj.bizUserId  }">
	             	<button type="button" onclick="goPayReady('${obj.sn}');"  class="weui_btn weui_btn_plain_primary weui_btn_mini">
	                   	支付
	           		</button>
	         </c:if>
		</div>
        <div class="weui_panel_bd">
            <div href="javascript:void(0);" class="weui_media_box weui_media_appmsg form-inline">
                <div class="weui_media_bd">
                    <h4 class="weui_media_title">快递公司：${obj.expCompName }</h4>
                    <p class="weui_media_desc">
                    	<i class="fa fa-male fa-fw"></i>物品信息：${obj.goodsType } ${obj.weight } kg 
                    	&nbsp;
                    	<i class="fa fa-cny fa-fw"></i>保价：
                    	<fmt:formatNumber value="${null == obj.supportValue?0:obj.supportValue }" pattern="#,##0.00"/>元
                    </p>
                    <%-- <p class="weui_media_desc"><i class="fa fa-cny fa-fw"></i>参考价格：<fmt:formatNumber value="${obj.proposedPrice }" pattern="#,##0.00"/>元</p> --%>
                    <p class="weui_media_desc"><i class="fa fa-cny fa-fw"></i>实际价格：<fmt:formatNumber value="${obj.amount }" pattern="#,##0.00"/>元 &nbsp;<c:if test="${obj.forPublic == '01' }"><span style="color: #00CD00;"><i class="fa fa-product-hunt fa-fw"></i>对公</c:if></p>
                    <p class="weui_media_desc"><i class="fa fa-th-list fa-fw"></i>订单号：${obj.sn }</p>
                    <p class="weui_media_desc"><i class="fa fa-barcode fa-fw"></i>条形码：<font id="barcodeFont">${obj.barCode }</font></p>
                    <p class="weui_media_desc"><i class="fa fa-reorder fa-fw"></i>快递单：
                    	<font id="expcodeFont">${obj.expressNo }
	                    	<c:if test="${obj.expressNo != null }">
	                    		<a href="http://m.kuaidi100.com/index_all.html?type=${obj.expCompCode }&postid=${obj.expressNo }" style="color: red;"> &nbsp;查看配送信息</a>
	                    	</c:if>
                    	</font>
                    </p>
                    <p class="weui_media_desc"><i class="fa fa-location-arrow fa-fw"></i>揽件地址：${obj.fromOperationAddrName }</p>
                </div>
            </div>
        </div>
        
        
        
        
        <div class="weui_panel_hd" style="font-size: 1.2em;">收件人信息</div>
        <div class="weui_panel_bd">
            <a href="javascript:void(0);" class="weui_media_box weui_media_appmsg form-inline">
                <div class="weui_media_bd">
                    <h4 class="weui_media_title">收件人：${obj.directionName } 
                    	<c:if test="${obj.state == '05'}">
								<font color="red" size="2em;" style="padding-left: 5px;">
								${obj.receiveUserName }(签收)</font>
				         </c:if>
                    </h4>
                    <p class="weui_media_desc"><i class="fa fa-phone fa-fw"></i>电话：${obj.directionPhone }</p>
                    <p class="weui_media_desc"><i class="fa fa-location-arrow fa-fw"></i>地址：${obj.directionAddress }</p>
                </div>
            </a>
        </div>
        
        <div class="weui_panel_hd" style="font-size: 1.2em;">寄件人信息</div>
        <div class="weui_panel_bd">
            <a href="javascript:void(0);" class="weui_media_box weui_media_appmsg form-inline">
                <div class="weui_media_bd">
                    <h4 class="weui_media_title">寄件人：${obj.fromName }</h4>
                    <p class="weui_media_desc"><i class="fa fa-phone fa-fw"></i>电话：${obj.fromPhone }</p>
                    <p class="weui_media_desc"><i class="fa fa-location-arrow fa-fw"></i>地址：${obj.fromAddress }</p>
                </div>
            </a>
        </div>
    </div>
</div>

<div class="pop">
    <i class="fa fa-home fa-lg popi"></i>
</div>
<c:if test="${(obj.state == '01' || obj.state == '02') && user.id == obj.bizUserId }">
	<div style="display: inline-block;height: 50px;">&nbsp;</div>
	<div class="weui_tabbar" style="position: fixed;bottom: 0%;left: 0%;background-color:#04BE02;">
	    <a href="javascript:void(0);" onclick="scan()" class="weui_tabbar_item weui_bar_item_on" >
	        <p class="weui_tabbar_label" style="line-height: 40px;font-size:1.2em;color: #ffffff">
	        	<c:if test="${obj.state == '01' }">扫码</c:if>
	        	<c:if test="${obj.state == '02' }">重新扫码</c:if>
	        </p>
	    </a>
	</div>
</c:if>

<!-- 引入微信样式代码提示工具开始 -->
<%@ include file="/pages/wx/wxClass.jsp"%>
<!-- 引入微信样式代码提示工具结束 -->
<%@ include file="/pages/wx/baseBottom.jsp"%>
</body>
</html>

